@extends("admin.frame_layout")
<?php $top_selected = "信息管理";$page_menu = "碎片组成" ?>
@section('content')
    <div class="rightinfo">
        <div class="tools">
            <form method="get" id="sform" action="#">
                <ul class="toolbar">
                    <li>
                        <a href="{{route('admin.frag.edit')}}">
                            <span><img src="{{asset('admin/imgs/t01.png')}}"/></span>添加新碎片
                        </a>
                    </li>
                    <li>
                        <input type="text" name="start" placeholder="开始时间"
                               onClick="laydate({istime: true,format: 'YYYY-MM-DD hh:mm:ss'})">
                    </li>
                    <li>
                        <input type="text" name="end" placeholder="结束时间"
                               onClick="laydate({istime: true,format: 'YYYY-MM-DD hh:mm:ss'})">
                    </li>
                    <li>
                        <select name="search_type" id="search_type">
                            <option value="">按分类筛选</option>
                                <option value="0">碎片位置</option>
                                <option value="1">碎片标示</option>
                        </select>
                    </li>
                    <li>
                        <input id="search_str" name="search_str" type="text" placeholder="搜索条件">
                    </li>
                    <li>
                        <select name="sort_type">
                            <option value="1">降序 ↓</option>
                            <option value="2" selected>升序 ↑</option>
                        </select>
                    </li>
                    <li>
                        <a href="javascript:void(0)" onclick="$('#sform').submit()">
                            <span><img src="{{asset('admin/imgs/ico06.png')}}" width="20px"
                                       height="20px"/></span>搜索
                        </a>
                    </li>
                </ul>
            </form>
        </div>

        <table class="tablelist">
            <thead>
            <tr>
                <th width="4%">操作</th>
                <th width="5%">编号<i class="sort"><img src="{{asset('admin/imgs/px.gif')}}"/></i></th>
                <th  width="17%"style="text-align: left;">碎片位置</th>
                <th width="20%" style="text-align: left;">碎片标示</th>
                <th style="text-align: left;">碎片图片</th>
                <th style="text-align: left;width:10%;">碎片标题</th>
                <th style="text-align: left;width:15%;">碎片内容</th>
                <th width="10%">创建时间</th>
            </tr>
            </thead>
            <tbody>
            @foreach($frags as $frag)
                <tr>
                    <td class="act" bind="#{{$frag->id}}">
                        <img src="{{asset('admin/imgs/t05.png')}}"/>菜单
                        <ul id="{{$frag->id}}">
                            <li>
                                <a href="{{route('admin.frag.edit',['id'=>isset($frag)?$frag->id:0])}}">
                                    <img src="{{asset('admin/imgs/d02.png')}}"/>编辑碎片
                                </a>
                            </li>
                            <li onclick="openOkDlg('{{route('admin.frag.del',['id'=>isset($frag)?$frag->id:0])}}')">
                                <img src="{{asset('admin/imgs/d02.png')}}"/>删除
                            </li>
                        </ul>
                    </td>
                    <td>{{empty($frag->id)?'无':$frag->id}}</td>
                    <td class="text-left">{{empty($frag->position)?'无':$frag->position}}</td>
                    <td class="text-left">{{empty($frag->slug)?'无':$frag->slug}}</td>
                    <td class="text-left">
                        @if($frag->picture != null)
                            <img src="{{asset($frag->picture)}}" width="80px" height="80px" alt="">
                        @else
                               无
                        @endif
                    </td>
                    <td class="text-left">{{empty($frag->title)?'无':$frag->title}}</td>
                    <td class="text-left">{{empty($frag->content)?'无':$frag->content}}</td>
                    <td>{{date("Y-m-d H:i:s",empty($frag->create_time)?'无':$frag->create_time)}}</td>
                </tr>
            @endforeach
            </tbody>
        </table>
        @include('admin.coms.fenye')
    </div>

    @include('admin.coms.dialog')
@endsection
@section('footer')
    <script src="{{asset('admin/js/laydate/laydate.js')}}"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            laydate.skin("dahong"); //大红色日期选择皮肤
            //初始化表格操作菜单
            $('.tablelist tbody tr:odd').addClass('odd');
            $(".tablelist .act").hover(function () {
                $($(this).attr("bind")).show();
            }, function () {
                $($(this).attr("bind")).hide();
            });
        });
    </script>
@endsection

